package com.wut.clock.service.impl;

import com.github.pagehelper.PageHelper;
import com.wut.clock.entity.SysLoginLog;
import com.wut.clock.entity.SysOperLog;
import com.wut.clock.mapper.SysLoginLogMapper;
import com.wut.clock.mapper.SysOperLogMapper;
import com.wut.clock.service.ILogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ZYH
 * @unit D9Lab
 * @description 日志实现类
 * @date 2022/5/30 18:22
 */
@Service
@RequiredArgsConstructor
public class LogServiceImpl implements ILogService {

    private final SysOperLogMapper operLogMapper;

    private final SysLoginLogMapper loginLogMapper;

    @Override
    public List<SysOperLog> getOperLogByCondition(String title, String operName, Integer status, String deptName, Integer companyId, String startTime, String endTime, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return operLogMapper.getOperLogByCondition(title,operName,status,deptName,startTime,endTime);
    }

    @Override
    public List<SysLoginLog> getLoginLogByCondition(String userName, String ipaddr, Integer status, String startTime, String endTime, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return loginLogMapper.getLoginLogByCondition(userName,ipaddr,status,startTime,endTime);
    }
}
